.awards {
  display: flex;
  flex-wrap: wrap;

  .emoji-icon {
    width: 20px;
    height: 20px;
  }

  // Show active state.
  .gl-button.selected {
    background-color: $blue-50;
    box-shadow: inset 0 0 0 2px $blue-500;
  }
}

.emoji-menu {
  display: none;
  position: absolute;
  top: 0;
  margin-top: 3px;
  padding: $gl-padding;
  z-index: $zindex-dropdown-menu;
  width: $award-emoji-width;
  font-size: 14px;
  background-color: $white;
  border: 1px solid $border-white-light;
  border-radius: $border-radius-base;
  box-shadow: 0 6px 12px $award-emoji-menu-shadow;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.2);
  transform-origin: 0 -45px;
  transition: 0.3s cubic-bezier(0.67, 0.06, 0.19, 1.44);
  transition-property: transform, opacity;

  &.is-rendered {
    display: block;
  }

  &.is-aligned-right {
    transform-origin: 100% -45px;
  }

  &.is-visible {
    pointer-events: all;
    opacity: 1;
    transform: scale(1);
  }

  .emoji-menu-content {
    height: 300px;
    overflow-y: scroll;
  }

  .disabled {
    cursor: default;
    opacity: 0.5;

    &:hover {
      transform: none;
    }
  }

  @include media-breakpoint-down(xs) {
    width: $award-emoji-width-xs;
  }
}

.emoji-search {
  background-image: url('');
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 16px;
}

.emoji-menu-list {
  margin-bottom: 0;
  padding-left: 0;
  list-style: none;
}

.emoji-menu-list-item {
  float: left;
  padding: 3px;
  margin-left: 1px;
  margin-right: 1px;
}

.emoji-menu-btn {
  display: block;
  cursor: pointer;
  width: 30px;
  height: 30px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: $border-radius-base;
  transition: transform 0.15s cubic-bezier(0.3, 0, 0.2, 2);

  &:hover {
    background-color: transparent;
    outline: 0;
    transform: scale(1.3);
  }

  &:focus,
  &:active {
    outline: 0;
  }

  .emoji-icon {
    display: inline-block;
    position: relative;
    top: 3px;
  }

  > gl-emoji {
    line-height: 1.5;
  }
}

.award-menu-holder {
  display: inline-block;

  .tooltip {
    white-space: nowrap;
  }
}

.gl-button.btn.award-control {
  margin: 4px 8px 4px 0;

  &.disabled {
    cursor: default;

    &:hover,
    &:focus,
    &:active {
      background-color: $white;
      border-color: $border-color;
      box-shadow: none;
    }
  }

  &.active,
  &:hover,
  &:active,
  &.is-active {
    .award-control-icon-neutral {
      opacity: 0;
    }

    .award-control-icon-positive {
      opacity: 1;
      transform: scale(1.15);
    }
  }

  &.active,
  &.is-active,
  &:active {
    background-color: $blue-50;
    border-color: $blue-200;
    box-shadow: inset 0 0 2px $blue-200;
  }

  &.is-active {
    .award-control-icon-positive {
      opacity: 0;
      transform: scale(1);
    }

    .award-control-icon-super-positive {
      opacity: 1;
      transform: scale(1);
    }
  }

  &.user-authored {
    cursor: default;
    background-color: $gray-light;
    border-color: $gray-100;
    color: $gl-text-color-disabled;

    gl-emoji {
      opacity: 0.4;
      filter: grayscale(100%);
    }
  }

  &.btn {
    &:focus {
      outline: 0;
    }
  }

  &.is-loading {
    .award-control-icon-normal,
    .emoji-icon {
      display: none;
    }

    .award-control-icon-loading {
      display: block;
    }
  }

  .icon,
  gl-emoji,
  .award-control-icon {
    vertical-align: middle;
    line-height: 0.5em;
  }

  .award-control-icon-loading {
    display: none;
  }

  .award-control-icon {
    color: $border-gray-normal;

    svg {
      height: $default-icon-size;
      width: $default-icon-size;
      border-radius: 50%;
      fill: $gray-500;
    }
  }

  .award-control-icon-positive,
  .award-control-icon-super-positive {
    @include transition(opacity, transform);
    opacity: 0;
    position: absolute;

    path {
      fill: $award-emoji-positive-add-lines;
    }
  }

  .award-control-text {
    vertical-align: middle;
  }
}


// The following encompasses the "add reaction" button redesign to
// align properly within GitLab UI's gl-button. The implementation
// above will be deprecated once all instances of "award emoji" are
// migrated to Vue.

.gl-button .award-emoji-block {
  display: contents;

  gl-emoji {
    margin-top: -1px;
    margin-bottom: -1px;

    img {
      top: 0;
    }
  }
}

.add-reaction-button {
  position: relative;

  // This forces the height and width of the inner content to match
  // other gl-buttons despite all child elements being set to
  // `position:absolute`


  .reaction-control-icon {
    .gl-icon {
      height: $default-icon-size;
      width: $default-icon-size;
    }
  }

  .reaction-control-icon-neutral {
    display: flex;
  }

  .reaction-control-icon-positive,
  .reaction-control-icon-super-positive {
    display: none;
  }

  &:hover,
  &.active,
  &:active,
  &.is-active {
    .reaction-control-icon-neutral {
      display: none;
    }
  }

  &:hover {
    .reaction-control-icon-positive {
      display: flex;
    }
  }

  &.active,
  &:active,
  &.is-active {
    .reaction-control-icon-positive {
      display: none;
    }

    .reaction-control-icon-super-positive {
      display: flex;
    }
  }

  &.disabled {
    cursor: default;

    &:hover,
    &:focus,
    &:active {
      .reaction-control-icon .gl-icon {
        color: inherit;
        transform: scale(1);
      }

      .reaction-control-icon-neutral {
        display: flex;
      }

      .reaction-control-icon-positive,
      .reaction-control-icon-super-positive {
        display: none;
      }
    }
  }
}
